/// 环保教育数据模型
/// 包含图片、标题、详情文字等信息
class EcoEducationEssence {
  final String id;
  final String image;
  final String title;
  final String detail;

  EcoEducationEssence({
    required this.id,
    required this.image,
    required this.title,
    required this.detail,
  });

  /// 从Map创建EcoEducationEssence
  factory EcoEducationEssence.fromMap(Map<String, dynamic> map) {
    return EcoEducationEssence(
      id: map['id'] as String,
      image: map['image'] as String,
      title: map['title'] as String,
      detail: map['detail'] as String,
    );
  }

  /// 转换为Map
  Map<String, dynamic> toMap() {
    return {'id': id, 'image': image, 'title': title, 'detail': detail};
  }

  /// 复制并更新部分字段
  EcoEducationEssence copyWith({
    String? id,
    String? image,
    String? title,
    String? detail,
  }) {
    return EcoEducationEssence(
      id: id ?? this.id,
      image: image ?? this.image,
      title: title ?? this.title,
      detail: detail ?? this.detail,
    );
  }
}
